/**
 * 弹窗，这个弹窗最多只会显示三个
 */
var Dialog = function(msg,level){
	this.msg = msg;
	this.obj = "body";
	if(Zxj.isDefine(level)){
		this.level = level;
	}else{
		this.level = "info";
	}
};
Dialog.prototype.show = function(){
	var maxAlert = 3;
	var html = "<div class='alert alert-"+this.level+" fade in' style=''>"+
					"<a href='#' class='close' data-dismiss='alert'> &times; </a>"+ 
					this.msg+
				"</div>";
	var alerts = $(".alert");
	console.log(alerts);
	if(alerts.length >= maxAlert){
		console.log(true);
		alerts[maxAlert-1].remove();
	}
	$(this.obj).prepend(html);
};


/**
 * 常用工具类
 */
var Zxj = function(){};
/**
 * 判断一个对象是否有定义
 * @param obj 判定的对象
 * @returns {Boolean} 如果已定义，则返回true
 */
Zxj.isDefine = function(obj){
	return obj !== null && obj !== undefined;
}